Skip to content

Allow custom bucket boundaries per Histogram#300

Merged
ryanfkeepers merged 21 commits intoalcionai:mainfrom
robertschonfeld:main
Apr 29, 2026
Merged

Allow custom bucket boundaries per Histogram#300
ryanfkeepers merged 21 commits intoalcionai:mainfrom
robertschonfeld:main

Conversation

@robertschonfeld
Copy link
Copy Markdown
Contributor

The OTel Go SDK uses explicit bucket boundaries that top out at 10,000. Any observation above that lands in the +Inf overflow bucket, and since Kibana's percentile() uses linear interpolation within buckets it silently maxes out at 10,000. Customizing the bucket boundaries is needed to measure latencies above 10,000

The OTel mechanism is explicit bucket boundaries via metric.WithExplicitBucketBoundaries at instrument creation time — per-instrument, not a global MeterProvider view.

Changes:

  • ExponentialBoundaries(min, max, count) — logarithmically-spaced buckets mirroring Prometheus's ExponentialBucketsRange
  • DefaultLatencyBoundariesMs — 20 buckets from 1–60,000
  • WithBoundaries(...) HistogramOption on Histogram[N] and RegisterHistogram
  • Tests covering the math, option propagation, and end-to-end Record bucket placement via a ManualReader-backed OTel context

Copy link
Copy Markdown
Contributor

@ryanfkeepers ryanfkeepers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments. In particular:

  • unit test fixups.
  • automatic usage of the default boundaries.
  • removal of the histogramConfig struct.

Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram_test.go
Comment thread ctats/histogram_test.go Outdated
Comment thread ctats/histogram_test.go Outdated
Comment thread ctats/histogram_test.go Outdated
Comment thread ctats/histogram_test.go
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go
Comment thread ctats/README.md Outdated
Comment thread ctats/README.md Outdated
Comment thread ctats/README.md Outdated
Comment thread ctats/README.md
Comment thread ctats/README.md Outdated
robertschonfeld and others added 10 commits April 28, 2026 17:49
Co-authored-by: Keepers <ryan.keepers@veeam.com>
Co-authored-by: Keepers <ryan.keepers@veeam.com>
Co-authored-by: Keepers <ryan.keepers@veeam.com>
Co-authored-by: Keepers <ryan.keepers@veeam.com>
Co-authored-by: Keepers <ryan.keepers@veeam.com>
Co-authored-by: Keepers <ryan.keepers@veeam.com>
Copy link
Copy Markdown
Contributor

@ryanfkeepers ryanfkeepers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple remaining tiny nits. Thanks for all the effort!

Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go
Comment thread ctats/histogram.go Outdated
Comment thread ctats/histogram.go Outdated
@ryanfkeepers ryanfkeepers merged commit 69777a7 into alcionai:main Apr 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants